# -*- coding: utf-8 -*-
# @File     : validators.py
# @Author   : bingjia
# @Time     : 2020/8/8 16:57
# @Desc     : 验证

from ..base.api import serializers


class RoleValidator(serializers.Serializer):
    """
    项目角色
    """
    name = serializers.CharField(max_length=256)
    slug = serializers.CharField(max_length=256, required=False)
    permissions = serializers.ListField()
    project_id = serializers.IntegerField()


class MembershipValidator(serializers.Serializer):
    """
    项目成员
    """
    role = serializers.CharField()
    project_id = serializers.IntegerField()
    full_name = serializers.CharField(max_length=256)


class ProjectValidator(serializers.Serializer):
    """
    项目全部验证
    """
    operation_date = serializers.DateTimeField()
    name = serializers.CharField(max_length=250)
    company = serializers.CharField(max_length=128)

    weather = serializers.CharField(required=False)
    sorties = serializers.IntegerField(required=False)
    description = serializers.CharField(required=False)
    end_date = serializers.DateTimeField(required=False)
    start_date = serializers.DateTimeField(required=False)
    fly_time = serializers.CharField(max_length=32, required=False)
    uav_name = serializers.CharField(max_length=255, required=False)
    location = serializers.CharField(max_length=128, required=False)
    camera_name = serializers.CharField(max_length=255, required=False)
